var showInfoPanelContent = function(node){
	Ext.Ajax.request({
		url    : 'distributor/getElement',
		params : {
			node: node.id
		},
		success: function(response, opts) {
			var responseJson = Ext.decode(response.responseText);
			if (responseJson.success === "true") {
				
				var IsCommonNotPerson;
				
				if ((node.id =='CompanyTreeRoot') || 
					(node.id.match('Division')) || 
					(node.id.match('Project'))) {
					
					IsCommonNotPerson = true;
	    		}
				else {
					IsCommonNotPerson = false;
				}
				
				if (IsCommonNotPerson) {
					var ptitle = responseJson.title;
					var pcemail = responseJson.email;
					var pstartDate = responseJson.startDate;
				} else {
					var pname = responseJson.name;
					var ppemail = responseJson.email;
					var pbirthDate = responseJson.birthDate;
					var phiredDate = responseJson.hiredDate;					
				}				
				
				if (node.id =='CompanyTreeRoot') {
					var wTitle = "Info: Company";
	    		}
				else if (node.id.match('Division')) {
					var wTitle = "Info: Division";
				}
				else if (node.id.match('Project')) {
					var wTitle = "Info: Project";
				}
				else {
					var paTitle = "Common Info: Person";
					var pbTitle = "Additional Info: Person";
				}
							
				if (IsCommonNotPerson) {					
					var infoCommonTextAreaTitle = new Ext.form.TextField({
						xtype: 'textfield',
						id: 'infoCommonTitle',
						fieldLabel: 'title',
						value: ptitle,
						anchor: '100%',
						editable: false,
						readOnly: true
					});

					var infoCommonTextAreaEmail = new Ext.form.TextField({
						xtype: 'textfield',
						id: 'infoCommonEmail',
						fieldLabel: 'email',
						value: pcemail,
						anchor: '100%',
						editable: false,
						readOnly: true	
					});
					
					var infoCommonStartDateField = new Ext.form.DateField({
						xtype: 'Datefield',
						id: 'infoCommonStartDate',
						fieldLabel: 'StartDate',
						value: new Date(pstartDate),
						anchor: '100%',
						editable: false,
						readOnly: true		
					});
					
					var aItems = [infoCommonTextAreaTitle, infoCommonTextAreaEmail, infoCommonStartDateField];
					
					var commonInfoPanel = new Ext.FormPanel({
						id: 'commonInfoPanelId',
						labelWidth: 100,
						frame:true,
						title: wTitle,
						bodyStyle:'padding:5px 5px 0',
						width: 450,
						defaults: {width: 300},
						defaultType: 'textfield',
						items: aItems
					});
				} else  {		
					var infoPersonTextAreaName = new Ext.form.TextField({
						xtype: 'textfield',
						id: 'infoPersonName',
						fieldLabel: 'name',
						value: pname,
						anchor: '100%',
						editable: false,
						readOnly: true		
					});
					
					var infoPersonTextAreaEmail = new Ext.form.TextField({
						xtype: 'textfield',
						id: 'infoPersonEmail',
						fieldLabel: 'email',
						value: ppemail,
						anchor: '100%',
						editable: false,
						readOnly: true		
					});
					
					var infoPersonBirthDateField = new Ext.form.DateField({
						xtype: 'Datefield',
						id: 'infoPersonBirthDate',
						fieldLabel: 'BirthDate',
						value: new Date(pbirthDate),
						anchor: '100%',
						editable: false,
						readOnly: true		
					});
					
					var infoPersonHiredDateField = new Ext.form.DateField({
						xtype: 'Datefield',
						id: 'infoPersonHiredDate',
						fieldLabel: 'HiredDate',
						value: new Date(phiredDate),
						anchor: '100%',
						editable: false,
						readOnly: true		
					});
					
					var paItems = [infoPersonTextAreaName, infoPersonTextAreaEmail];
					var pbItems = [infoPersonBirthDateField, infoPersonHiredDateField];
					
					var personInfoForm1 = new Ext.FormPanel({
						id: 'personInfoPanel1Id',
						labelWidth: 100,
						frame:true,
						title: paTitle,
						bodyStyle:'padding:5px 5px 0',
						width: 450,
						defaults: {width: 300},
						defaultType: 'textfield',
						items: paItems
					});
					
					var personInfoForm2 = new Ext.FormPanel({
						id: 'personInfoPanel2Id',
						labelWidth: 100,
						frame:true,
						title: pbTitle,
						bodyStyle:'padding:5px 5px 0',
						width: 450,
						defaults: {width: 300},
						defaultType: 'textfield',
						items: pbItems
					});
					
					var personInfoPanel = new Ext.TabPanel({
						id: 'personInfoPanelId',
						activeTab: 0,
						frame:true,
						items: [personInfoForm1, personInfoForm2]
					});
				}
				
				var infopan = Ext.getCmp('infoPanelId');
				
				if (IsCommonNotPerson) {
					infopan.removeAll();
					infopan.add(commonInfoPanel);
					infopan.layout.setActiveItem('commonInfoPanelId');
	    		} else {
	    			infopan.removeAll();
					infopan.add(personInfoPanel);
					infopan.layout.setActiveItem('personInfoPanelId');
				}
				
				infopan.doLayout();
			}
			else {
				Ext.Msg.alert('An error occured with the server.');
			}
		}
	});
};